package org.byqh.dqeai.controller;

import io.swagger.v3.oas.annotations.tags.Tag;
import org.byqh.dqeai.common.Json;
import org.byqh.dqeai.entity.SoftFavorites;
import org.byqh.dqeai.entity.proxy.SoftFavoritesProxy;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/softFavorites")
@Tag(name = "系统[SoftFavorites] - 软件收藏管理")
public class SoftFavoritesController
        extends BaseOpController<SoftFavorites, SoftFavoritesProxy> {
    /**
     * 按userId查询所有
     */
    @GetMapping("listByUserId")
    public Json<List<SoftFavorites>> listByUserId(
            @RequestParam String userId) {
        return this.listImpl(SoftFavorites.class, query -> {
            return query.where(o -> o.userId().eq(userId));
        });
    }
}